import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    authorization: '',
    user: {},
    course: {
      courseId: 0,
      courseName: '',
      coursePeriod: 0,
      coursePoint: 0,
      courseContent: '',
      courseStatus:'',
    },
    workIds:[],
  },
  mutations: {
    changeUserAvatar (state, payload) {
      this.state.user.avatar = payload.avatar
    },
    changeUserNickname (state, payload) {
      this.state.user.nickname = payload.nickname
    },
    changeUser (state, payload) {
      this.state.user = payload.user
    },
    changeCourse (state, payload) {
      this.state.course = payload.course
    },
  },
  actions: {},
  modules: {}
})
